#include<bits/stdc++.h>
#define ___ "-------------------------------\n"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll maxn = 100000 + 5;

class Solution {
public:
    int longestNiceSubarray(vector<int>& nums) {
        int n = nums.size();
        int ans = 0;
        int or_res = 0;
        int i = 0, j = 0;
        while (j < n) {
            if (!(nums[j] & or_res)) {
                ans = max(j - i + 1, ans);
                or_res |= nums[j++];
            } else {
                while (nums[j] & or_res) {
                    or_res ^= nums[i++];
                }
            }
        }
        return ans;
    }
};

int main(){
//    ios::sync_with_stdio(false);
//    ifstream cin("data.txt");
//    freopen("data.txt", "r", stdin);
    return 0;
}

/**
 * @date 2022-09-04
 * @brief 双指针
 */